<div id="charge">
  <div>
    <i-table
      highlight-row
      ref="currentRowTable"
      :columns="columns3"
      :data="chargeRecord"
      height="500"
      style="width: 1285px; margin: 20px auto"
    ></i-table>
  </div>
</div>

<script>
  new Vue({
    el: "#charge",
    data: {
      columns3: [
        {
          type: "index",
          width: 60,
          align: "center",
        },
        {
          title: "地点标识",
          key: "chargingPile_id",
        },
        {
          title: "充电人员",
          key: "chargePerson",
        },
        {
          title: "充电花费",
          key: "fees",
        },
        {
          title: "充电时长",
          key: "duration",
        },
      ],
      chargeRecord: [],
    },
    methods: {
      //获取数据
      getCharge() {
        var that = this;
        $.ajax({
          url: "http://3v.gsdse.cn/UEBIMP/public/index.php/index/Chargerecord/selectChargeRecord",
          type: "post",
          success(res) {
            if (res.error_code == 0) {
              console.log(res.msg);
              console.log(res.data);
              that.chargeRecord = res.data;
            }
          },
          error() {
            console.log("请求失败");
          },
        });
      },
      handleClearCurrentRow() {
        this.$refs.currentRowTable.clearCurrentRow();
      },
    },
    mounted: function () {
      this.getCharge();
    },
  });
</script>
